﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="BluewaterSoft.Notepad.TextShareTargetPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BluewaterSoft.Notepad"
    xmlns:common="using:BluewaterSoft.Notepad.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:ExtensionType="ShareTarget"
    >

    <Page.Resources>
        <common:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <common:BooleanNegationConverter x:Key="BooleanNegationConverter"/>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines three rows:
        * Row 0 contains the standard share target header
        * Row 1 contains application-specific UI appropriate to the supported sharing scenario
        * Row 2 contains the standard share target footer
    -->
    <Grid Background="White">
        <Grid Margin="40,20,40,60">
            <Grid.RowDefinitions>
                <RowDefinition Height="200"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!-- The standard share target header displays metadata about the shared item -->
            <Image
                Source="{Binding Image}"
                Stretch="Uniform"
                Visibility="{Binding ShowImage, Converter={StaticResource BooleanToVisibilityConverter}}"
                MinWidth="80"
                MinHeight="80"
                MaxWidth="240"
                MaxHeight="160"
                Margin="0,0,20,0"/>
            <StackPanel Grid.Column="1">
                <TextBlock
                    Text="{Binding Title}"
                    Margin="0,-10,0,20"
                    TextWrapping="NoWrap"
                    Style="{StaticResource DescriptionTextStyle}"/>
                <TextBox x:Name="TextBoxDescription"
                    Text="{Binding Description}"
                    MinHeight="60"
                    AcceptsReturn="True"
                    IsTextPredictionEnabled="False"
                    ScrollViewer.VerticalScrollMode="Enabled"
                    ScrollViewer.VerticalScrollBarVisibility="Auto"
                    Style="{StaticResource DescriptionTextboxStyle}"/>
            </StackPanel>

            <Grid Grid.Row="1" Grid.ColumnSpan="2">
                <!-- TODO: Add application scenario-specific sharing UI -->
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Text="ファイル名"     
                    TextWrapping="NoWrap"
                    Margin="100,0,0,20"
                    Style="{StaticResource DescriptionTextStyle}"/>
                <TextBox Grid.Column="1"
                         x:Name="TextBoxFileName"
                    Text="{Binding FileName}"
                    AcceptsReturn="False"
                    IsTextPredictionEnabled="False"
                    Style="{StaticResource DescriptionTextboxStyle}"/>

            </Grid>
        
            <!-- Standard share target footer -->
            <Grid Grid.Row="2" Grid.ColumnSpan="2" Margin="0,20,0,0">
                <ProgressRing
                    IsActive="{Binding Sharing}"
                    MinWidth="20"
                    MinHeight="20"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top"
                    Margin="0,5,0,0"/>
                <TextBlock
                    Text="Sharing&#x2026;"
                    Visibility="{Binding Sharing, Converter={StaticResource BooleanToVisibilityConverter}}"
                    HorizontalAlignment="Left"
                    Margin="25,0,0,0"
                    Style="{StaticResource DescriptionTextStyle}"/>
                <Button
                    AutomationProperties.AutomationId="ShareButton"
                    AutomationProperties.Name="Share"
                    Content="マイ ドキュメントに保存"
                    IsEnabled="{Binding Sharing, Converter={StaticResource BooleanNegationConverter}}"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    Margin="0,-5,0,0"
                    Click="ShareButton_Click" BorderBrush="{StaticResource InputControlGlyphBrush}" Foreground="{StaticResource InputControlTextBrush}" 
                    
                    
                    />
            </Grid>
        </Grid>
    </Grid>
</common:LayoutAwarePage>
